# -*- makefile -*-
# GCC makefile fragment for MeP
# Copyright (C) 2001-2015 Free Software Foundation, Inc.
# Contributed by Red Hat Inc
#
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GCC is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.  */

# Force genpreds to be rebuilt in case MeP-Integrator changed the predicates

GTM_H = tm.h $(tm_file_list) $(srcdir)/config/mep/mep-intrin.h insn-constants.h

TCFLAGS = -mlibrary

mep-pragma.o: $(srcdir)/config/mep/mep-pragma.c $(CONFIG_H) $(SYSTEM_H) \
	coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(C_PRAGMA_H) \
	$(CPPLIB_H) hard-reg-set.h output.h $(srcdir)/config/mep/mep-protos.h \
	function.h insn-config.h reload.h $(TARGET_H)
	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<

MULTILIB_OPTIONS = mel mall-opts mfar
MULTILIB_DIRNAMES = el allopt far

MD_INCLUDES = \
	$(srcdir)/config/mep/intrinsics.md \
	$(srcdir)/config/mep/predicates.md \
	$(srcdir)/config/mep/constraints.md

mep.o : $(srcdir)/config/mep/mep-intrin.h dumpfile.h

# begin-isas
MEP_CORE = ext_core1
MEP_COPRO = ext_cop1_16,ext_cop1_32,ext_cop1_48,ext_cop1_64
# end-isas

# To use this, you must have cgen and cgen/cpu in the same source tree as
# gcc.
cgen-maint :
	S=`cd $(srcdir); pwd`; \
	cd $$S/config/mep && \
	guile -s $$S/../cgen/cgen-intrinsics.scm \
		-s $$S/../cgen \
		$(CGENFLAGS) \
		-a $$S/../cgen/cpu/mep.cpu \
		-m mep,c5 \
		-i mep,$(MEP_CORE),$(MEP_COPRO) \
		-K mep,$(MEP_CORE),$(MEP_COPRO) \
		-M intrinsics.md \
		-N mep-intrin.h \
		-P intrinsics.h

# start-extra-headers
EXTRA_HEADERS = $(srcdir)/config/mep/intrinsics.h \
	$(srcdir)/config/mep/default.h
# end-extra-headers
